package com.ktr.controller;

import com.ktr.entity.KtrAddress;
import com.ktr.service.KtrAddressService;
import com.bhudy.base.QueryFilter;
import com.sys.utils.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author com.bhudy
 * @Description KtrAddressController
 * @Date 2019-10-30 23:09:37
 */
@RestController
public class KtrAddressController {

    @Autowired
    private KtrAddressService ktrAddressService;

    @GetMapping(value = "/api/v1/ktrAddresss")
    public Object getAll(){
        QueryFilter queryFilter = new QueryFilter();
        queryFilter.clear();
        return RequestUtils.printMapJson(0, ktrAddressService.findList(queryFilter));
    }

    @GetMapping(value = "/api/v1/ktrAddress")
    public Object get(Long ktrId) {
        return RequestUtils.printMapJson(0, ktrAddressService.get(ktrId));
    }

    @PostMapping(value = "/api/v1/ktrAddress")
    public Object insert(KtrAddress ktrAddress){
        return RequestUtils.printMapJson(0, ktrAddressService.insert(ktrAddress));
    }

    @PutMapping(value = "/api/v1/ktrAddress")
    public Object update(KtrAddress ktrAddress){
        return RequestUtils.printMapJson(0, ktrAddressService.update(ktrAddress));
    }

    @DeleteMapping(value = "/api/v1/ktrAddress")
    public Object delete(Long[] ktrId) {
        return RequestUtils.printMapJson(0, ktrAddressService.delete(ktrId));
    }

}
